package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 活动状态(1-未使用，2-已使用，3-已核销，4-已过期)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum ActiveRedPacketStateEnum {

    NO_USE(1, "未使用"),
    YES_UES(2, "已使用"),
    YES_VERIFY(3, "已核销"),
    YES_EXPIRE(4, "已过期"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    ActiveRedPacketStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static ActiveRedPacketStateEnum typeOf(Integer value) {
        ActiveRedPacketStateEnum[] values = ActiveRedPacketStateEnum.values();
        for (ActiveRedPacketStateEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static ActiveRedPacketStateEnum typeOf(String name) {
        ActiveRedPacketStateEnum[] values = ActiveRedPacketStateEnum.values();
        for (ActiveRedPacketStateEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
